<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="/struts-tags" prefix="s"%>

<link rel="stylesheet" href="styles/form-input.css" type="text/css" media="all" />
<link rel="stylesheet" href="styles/displaytag.css" type="text/css" media="all" />
<link type="text/css" rel="stylesheet" href="js/jquery/css/ui-lightness/jquery-ui-1.8.16.custom.css"/>
<script type="text/javascript" src="js/jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
   		$("button").button();
 		});
	
	var formSubmitted=false;  
	function preventDoubleSubmit() {  
	   if(formSubmitted) {  
	      return false;  
	   }  
	   
	   formSubmitted = true;  
	   return true;  
	}	
</script>

<sec:authorize access="hasRole('R_ADMIN')">
	<div class="error-text"><s:actionerror /></div>
	<div class="error-text"><s:fielderror /></div>
	<div class="message-text"><s:actionmessage /></div>
	
	<h3>User Group Role</h3>
	<div align="center">
		<s:form theme="simple" validate="true" method="POST" >
			<s:hidden name="groupRoleId"/>
			<fieldset style="width:450px">
            	<legend><h3>Group Role</h3></legend>
            	<div align="left">
            		<table cellpadding="3" class="table-form">
						<tr><td id="td1">Group Name</td><td><s:textfield name="groupName" maxlength="50" size="33"/></td></tr>
						<tr><td id="td1">Description</td><td><s:textarea name="description" maxlength="100" cols="25" rows="3"/></td></tr>
					</table>					
            	</div>            	
            	<legend><h3>Access Menu</h3></legend>
            	<div align="left">            		
					<table>			
						<tr><td><s:checkbox name="role01"/></td><td>Maintain Region</td><td><s:checkbox name="role06"/></td><td>Manual Download</td>	<td><s:checkbox name="role11"/></td><td>Report Open Account</td></tr>
						<tr><td><s:checkbox name="role02"/></td><td>Maintain Area</td>	<td><s:checkbox name="role07"/></td><td>Receiving Document</td>	<td><s:checkbox name="role12"/></td><td>Report SLA Summary</td></tr>
						<tr><td><s:checkbox name="role03"/></td><td>Maintain Branch</td><td><s:checkbox name="role08"/></td><td>Completing Document</td><td><s:checkbox name="role13"/></td><td>Report SLA Detail</td></tr>
						<tr><td><s:checkbox name="role04"/></td><td>Admin</td>			<td><s:checkbox name="role09"/></td><td>Checklist</td>			<td><s:checkbox name="role14"/></td><td>Report Close Account</td></tr>
						<tr><td><s:checkbox name="role05"/></td><td>Parameter</td>		<td><s:checkbox name="role10"/></td><td>Approval</td>			<td><s:checkbox name="role15"/></td><td>Report Upload Summary</td></tr>
					</table>
            	</div>
            	<br>
				<s:submit type="button" action="addOrUpdateGroupRole">SUBMIT</s:submit>
				<c:if test="${groupRoleId!=null}">
					<button type="button" onclick="window.location.href='listGroupRole'">CANCEL</button>
					<%-- <s:submit type="button" action="resetPassword">RESET PASSWORD</s:submit> --%>
				</c:if>			
			</fieldset>
			<s:token />
		</s:form>
	</div>
	<br>
	<br>
	<div>
		<display:table 	id			= "um"
              			name       	= "${groupRoles}"
             			pagesize   	= "10" style="width: 800px"
              			requestURI 	= "/listGroupRole" class="display" >
              	              	
   			<display:column title	= "NO."
              				value   = "${um_rowNum}" />
              				   
		   	<display:column title 	= "Group Name"
		   					nulls	= "false" sortable= "true" >
		   		<c:url var="urlEditGroupRole" value="editGroupRole">
					<c:param name="id" value="${um.id}"/>
				</c:url>
				<a href="${urlEditGroupRole}">${um.groupName}</a>
		   	</display:column>
		   	
		   	<display:column title 	= "Description"
		   					value	= "${um.groupDesc}" 
		   					nulls	= "false" sortable= "true" />
		   			   					
		   	<display:column title 	= "">
				<c:url var="urlRemoveGroupRole" value="removeGroupRole">
					<c:param name="id" value="${um.id}"/>
				</c:url>
		   		<a href="${urlRemoveGroupRole}" onclick="return confirm('Delete this Group Role?');">[Delete]</a>
		   	</display:column>
		</display:table>
	</div>
</sec:authorize>